package com.zz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 序列化类型
 *
 * @author zz
 */
@AllArgsConstructor
@Getter
public enum SerializationType {

    PROTOSTUFF((byte) 1, "protostuff"),
    JSON((byte) 2, "jackson");


    private final byte code;
    private final String desc;

    public static SerializationType getInstance(byte code) {
        for (SerializationType value : SerializationType.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
